import wsgiref.handlers
from src.BeautifulSoup import BeautifulSoup
from google.appengine.api import urlfetch
from google.appengine.ext import webapp

class Test(webapp.RequestHandler):
    def get(self):
        self.response.out.write("<ul>")
        self.response.out.write(r"<li><a href=""/testCrawler"">Test crawler</a></li>")
        self.response.out.write("</ul>")


class TestCrawler(webapp.RequestHandler):
    
    _url = "http://www.google.ru"
    
    def get(self):
        result = urlfetch.fetch(self._url, None, urlfetch.GET, {'Accept-Charset':'utf-8'})
        soup = BeautifulSoup(result.content)
        links = soup('a')
        self.response.out.write(links)
        
        
class TestXslt(webapp.RequestHandler):
    def get(self):
        
        return